<%@page import="com.alisveris.pojo.Urun"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="com.alisveris.dao.AlisVerisSepeti"%>
<%@page import="com.utility.Utility"%>
<%@page import="com.alisveris.dao.PagingController"%>
<%@page import="com.alisveris.pojo.UrunResimPojo"%>
<%@page import="org.apache.commons.lang3.StringUtils"%>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.io.*" %>
<%@ page language="java" import="com.login.*" %>
<%@ page contentType="text/html; charset=iso-8859-9"%>
<jsp:useBean id="authentication" class="com.login.AuthenticationFilterForLogin" scope="request"/>
<jsp:useBean id="urunListDao" class="com.alisveris.dao.UrunListDao" scope="request"/>
<jsp:useBean id="pagingController" class="com.alisveris.dao.PagingController" scope="request"/> 

<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Personel Web Page</title>	  
 	     <link rel="stylesheet" href="/e_ticaret/css/general.css" type="text/css"/> 	    
	     <script type="text/javascript" src="/e_ticaret/js/jquery-1.9.1.min.js"></script>
	    <script type="text/javascript"> 
	       $(document).ready(function() {
	    	  
	    	    $("#body_center_top").load("/e_ticaret/slider3.jsp"); 
		        /* $(".banner_center").load("slider.jsp");  */
		    });
		    
	      function  loginFunction(object){
	    	  
	    	 
	    	 
	    	  if(object.name=='passwordId'){
	    		  
	    		  
	    		  
	    		//  if(document.getElementById("passwordId").value!="Password"){
	    			  
	    		
	    		  
			    		  if(document.getElementById("userId").value=="Email"){
			    			  
			    			  object.value=""; 
			    			  
			    		  }else if(document.getElementById("passwordId").value=="Password"){
			    			  
			    			  object.value="";
			    		  }
	    		  
	    		  
	    		//  }
	    		  
	    		  
	    		  document.getElementById("userId").value="Email"; 
	    		  
	    	  }else if(object.name=='userId'){
	    		  
	    		  
	    		  //if(document.getElementById("userId").value!="Email"){  
	    		  
	    		  
                    if(document.getElementById("passwordId").value=="Password"){
	    			  
	    			  object.value=""; 
	    			  
	    		    }else if(document.getElementById("userId").value=="Email"){
	    		    	  object.value=""; 
	    		    }
	    		 // }
	    		  
	    		  document.getElementById("passwordId").value="Password";	  
	    	  }
	    	  
	    	  
	    	 	  
	      }
	    
	      
	      function urun_detay(product,urunKod){      
	    	  window.location.href = "/e_ticaret/detay.jsp?product="+product+"&urunKod="+urunKod;  
	      }
	      
	      
	      function sepete_at(urunFiyat,urunKod,urunMiktar,urunIsmi,pageNumber){
	    	 
	    	  window.location.href = "/e_ticaret/alisveris/Add?urunFiyat="+urunFiyat+"&urunKod="+urunKod+"&urunMiktar="+urunMiktar+"&urunIsmi="+urunIsmi+"&pageNumber="+pageNumber;		    	      	 
	      }
	    
	      function sepeteCikar(i){
	    	   window.location.href="/e_ticaret/alisveris/sepeteCikar?urun="+i;
	      }
	      
	      function not_login(){
	    	  
	    	  window.location.href="/e_ticaret/anasayfa/musteriBilgileri.jsp?not_login="+not_login;
	    	  
	      }
	      
	       
		   	    
       </script>
        
	   <style type="text/css">
	            
	       
				       
	        
	   </style>
	   
	  
	</head>
    
  
    
	
	<body>
           <%ResourceBundle resource = ResourceBundle.getBundle("properties.bundle.Messages_tr");%>
	 <div id="conteyner">
		  <div id="header">
		            
		             <div id="banner">
		             
		                 <div class="banner_left" style="text-indent: -30000px;">1</div>
		                 <div  class="banner_center"><img  src="/e_ticaret/images/banner.jpg" width="100%" height="100%"></img></div>
		                 <div class="banner_right" style="text-indent: -30000px;">3</div>
		               
		             
		             </div>
						
					 <div class="menu">				 
					 
		                       <ul>
		                          <li><a href="/e_ticaret/anasayfa/index.jsp">Home</a></li>
								  <li><a href="/e_ticaret/anasayfa/about.jsp">About</a></li>								
								  <li><a href="/e_ticaret/anasayfa/contact.jsp">Contact</a></li>
								</ul>
					 
					</div>
							
			</div>
			
			<div id="body">
			        
			        
			        <div class="body_left">
			        
			             <div class="body_left_top" >
			                <img src="/e_ticaret/images/sepet_logo.jpg" width="100%"/>
			                <p><%=resource.getString("sepete.urun.atiniz")%></p> 
			             </div>
					             <div class="body_left_center">
					             
					                <%	
					                
					             // Alışveriş sepetinin session'dan çekilmesi
					                AlisVerisSepeti sepet =   (AlisVerisSepeti) session.getAttribute("AlisVerisSepeti");    
					                 

					                // Kullanıcı eğer sepet oluşturmamışsa 
					                // yeni bir sepet oluşturma
					                if (sepet == null) {
					                    sepet = new AlisVerisSepeti();
					             	    session.setAttribute("AlisVerisSepeti", sepet);
					                }
					                
					                // Ürün fiyatını formatlı yazmak için 
					                // gerekli referansın oluşturulması	  
					                  NumberFormat f = NumberFormat.getCurrencyInstance(new Locale("tr", "TR"));

					                // Sepetteki ürünlerin alınması
					                 Vector urunler = sepet.getUrunler();   
					                   
					                 int urunSayisi = urunler.size();
					           	  
					           	  for (int i = 0; i < urunSayisi; i++) {
					           	     Urun urun = (Urun) urunler.elementAt(i);
					           		 
					           	     // Seçilen ürün bilgilerinin tablo
					           		 // içine yerleştirilmesi				           	   
					                %>
					                
					                <table>
					                 
					                  <tr>
					                      <td class="sepet_row">				                  
					                         <span class="sepet_urun_text"><p><%=urun.getIsmi()%></p></span>				                      
					                      </td> 
					                      
					                      <td class="sepet_row">				                           
					                         <input type="button" value="Sepetten Cikar"  class="sepetecikar_button" onclick="sepeteCikar('<%=i%>');" />					                        
	                                     </td>
	                                 </tr>
					                  
					                </table>
					            
					                
					                
					            <%}%>
					            
					            
					                <%if(urunler.size()==0){%>
					                <p><%=resource.getString("sepet.bos")%><p/>
					                <%}%>
					                                 
					               
					             </div>
			             <div class="body_left_bottom"><img src="/e_ticaret/images/e-ticaret.png" width="100%" height="100%"/></div>

			        </div>
			        
			        
			        <div class="body_center" >
			               
			            
			            <div id="body_center_top"></div><!--slider geliyor-->
			               			              			               
			            <div class="body_center_center" >
					            <%if(request.getParameter("not_login")!=null){
					            
					            	
					            %>
					            <div style="text-align: center;color: red;font-weight: bold;merge-top:8px;">
			                        <p align="center"><%=resource.getString("not_login")%></p >
			                    </div> 

					            <%}%>
								<form  method="post" action="/e_ticaret/alisveris/Onayla.jsp">	      
								  
								  <table>										      					
										<tr>
										    <td colspan="2" align="center" ><span class="text_label_title">Adres Bilgileriniz</span></td>										    
										</tr>
										
										<tr>
										    <td><span class="text_label">isim</span></td>
										    <td><input class="onay_input" type="text" id="isim" name="isim"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">Adres-1</span></td>
										    <td><input class="onay_input" type="text" id="adres1"  name="adres1"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">Adres-2</span></td>
										    <td><input class="onay_input" type="text" id="adres2"  name="adres2"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">sehir</span></td>
										    <td><input class="onay_input" type="text" id="sehir" name="sehir"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">ulke</span></td>
										    <td><input class="onay_input" type="text"  id="ulke" name="ulke"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">Posta Kodu</span></td>
										    <td><input class="onay_input" type="text"  id="pkod"  name="pKod"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">Telefon</span></td>
										    <td><input class="onay_input" type="text" id="telefon" name="telefon"></td>
										</tr>
										
										<tr>
										    <td><span class="text_label">Elektronik Posta</span></td>
										    <td><input class="onay_input" type="text" id="ePosta"  name="ePosta"></td>
										</tr>
																																	
										<tr>
										    <td colspan="2" align="center"><span class="text_label_title">Kart Bilgileriniz</span></td>				
										</tr>
										
										<tr>
										    <td><span class="text_label">ismi</span></td>
										    <td><input class="onay_input" type="text"  id="kIsmi"  name="kIsmi"></td>											
										</tr>
										
										<tr>
										    <td><span class="text_label">Numarasi</span></td>
										    <td><input class="onay_input" type="text" id="KNumara"  name="kNumara"></td>
										</tr>
										
										<tr>										
										    <td><span class="text_label">Kredi Karti Tipi</span></td>
										    <td>
										      <select  id="kTip"  name="kTip" class="onay_combobox">
											      <option selected value="visa">Visa</option>
												  <option value="master">Master Kart</option>
												  <option value="elect">Electron</option>
												</select>
											</td>
										</tr>
											
								 </table>
								 
								 
								 <table style="margin-top: 30px;">
								  
					
								  
								  <tr align="center">
										    <td colspan="3">
										      <input type="button" value="Go Back" id="goBack" name="goBack" class="alisveris_button" onclick="goBack();" />
										     
										     <% if(session.getAttribute("username")!=null && session.getAttribute("password")!=null){%>
										      <input type="submit" class="onay_button" id="kaydet" name="kaydet" value="Alis Verisi Tamamla">
										     <%}else{%> 
										      <input type="button" class="onay_button" id="kaydet_not" name="kaydet_not" value="Alis Verisi Tamamla" onclick="not_login();">
										     <%}%>
										      <input type="Reset" class="onay_button" id="sil" name="sil" value="Temizle">										    
										    </td>							
								   </tr>
								 
								 </table>
								 
								 
								 
								 											 
							 </form>					 							 	 		         
			             </div>
			            
			             
			             <div class="body_center_bottom">
							
						
		                     
						 </div> 	 
			            
			            
			           
			         </div>
			        		        
			         <div class="body_right">			         
			             <div class="body_right_top">
			                  <div class="body_right_top_top" style="text-indent: -30000px">1</div>
			                  <div class="body_right_top_middle">
			                    <form id="loginForm" name="loginForm" action="/e_ticaret/login.jsp"   method="post" >
			                     <%		                     
			                        String username =(String)session.getAttribute("username");		                     
			                        String password = (String)session.getAttribute("password");			                 		                     			                    
			                     %>
			                     
			                     <%if(username==null && password==null){%>
			                     <input type="text" id="userId" name="userId"  placeholder="Email"/><br/>
			                     <input type="text" id="passwordId" name="passwordId"  placeholder="Password"/><br/>
			                     <input type="submit" value="Login" id="loginId" name="loginId" class="login_logout"  />
			                     <%}else{%>	
			                      <br/><br/><br/>		                     			                      
			                      <input type="submit" value="Logout" id="logoutId" class="logoutButton"   name="logoutId"  />	
			                     <p align="center" class="logoutUsername"><%=username%></p >                    			                     			                     
			                     
			                      <%}%>
			                      
			                    
			                    </form>
			                     
			                  </div>
			                  <div class="body_right_top_bottom">
			                    <br/><br/>
			                    <%			                    
			                    String message = (String)request.getAttribute("message");			                    
			                    if(!StringUtils.isBlank(message)){ 			                    
			                    %>
			                    <div style="text-align: center;position: relative; top: -20%;color: red;font-weight: bold;">
			                    <p align="center"><%=message%></p >
			                    </div>  
			                    <%}%>		                  
			                  </div>
			             </div>
			             <div class="body_right_middle"><img src="/e_ticaret/images/sale_advert.jpg" width="100%" height="100%"/></div>
			             <div class="body_right_bottom"><img src="/e_ticaret/images/sale.jpg" width="100%" height="100%"/></div>	
			         </div>

			</div>
				<%	
					String footer =resource.getString("rezarvasyon.alt.baslik");																										
                %>		
			<div id="footer">
			  
			  
				  <div class="parentFooter">
				      <div class="childFooter">
				          <p><%=footer%></p>
				       </div>			      
				   </div>
			  
			   
			</div>
			
		</div>
			
	</body>
</html>